package com.guli.secKill.config;

import com.guli.secKill.interceptor.LoginInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/*
 * @Author 罗俊
 * @date 2020/12/2 - 3:19 下午
 *
 */
@Configuration
@Slf4j
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        LoginInterceptor loginInterceptor = new LoginInterceptor();

        log.info("正在为秒杀接口配置登陆拦截器");

        registry.addInterceptor(loginInterceptor).addPathPatterns("/seckill/front/executeSecKill");
    }
}
